package br.com.usp.server;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import br.com.usp.shared.BMMDTO;


@Entity(name="TB_TASK_FLOW")
public class TaskFlow {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ID_FLOW")
    private int id;
	
	@Column(name="Nome")
	private String Descricao;
	
	@Column
    private String Tipo;
	
    @Column(name="Descricao")
    private String Representacao;
    
    @Column(name="ESQ")
	private int  left;
    
    @Column(name="CIMA")
	private int   top;

    @ManyToOne 
    @JoinColumn(name="ID_ACTIVITY", referencedColumnName="ID_FLOW") 
    private ActivityFlow activity;

    @OneToMany(cascade=CascadeType.ALL ,mappedBy="de")
    private List<ConnectorTask> listaConnectorTaskDe;
    
    @OneToMany(cascade=CascadeType.ALL ,mappedBy="para")
    private List<ConnectorTask> listaConnectorTaskPara;
	
    
    public TaskFlow()
    {
    	 
    	listaConnectorTaskDe = new ArrayList<ConnectorTask>();
    	listaConnectorTaskPara = new ArrayList<ConnectorTask>();
    }

    public TaskFlow(BMMDTO bmm)
    {
    	this.id = bmm.getId();
    	this.Descricao = bmm.getDescricao();
    	this.Tipo = bmm.getTipo();
        this.Representacao = bmm.getRepresentacao();
        this.left = bmm.getLeft();
        this.top = bmm.getTop();
    	listaConnectorTaskDe = new ArrayList<ConnectorTask>();
    	listaConnectorTaskPara = new ArrayList<ConnectorTask>();
    }

	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public String getDescricao() {
		return Descricao;
	}


	public void setDescricao(String descricao) {
		Descricao = descricao;
	}


	public String getTipo() {
		return Tipo;
	}


	public void setTipo(String tipo) {
		Tipo = tipo;
	}


	public String getRepresentacao() {
		return Representacao;
	}


	public void setRepresentacao(String representacao) {
		Representacao = representacao;
	}


	public int getLeft() {
		return left;
	}


	public void setLeft(int left) {
		this.left = left;
	}


	public int getTop() {
		return top;
	}


	public void setTop(int top) {
		this.top = top;
	}


	public ActivityFlow getActivity() {
		return activity;
	}


	public void setActivity(ActivityFlow activity) {
		this.activity = activity;
	}


	public List<ConnectorTask> getListaConnectorTaskDe() {
		return listaConnectorTaskDe;
	}


	public void setListaConnectorTaskDe(List<ConnectorTask> listaConnectorTaskDe) {
		this.listaConnectorTaskDe = listaConnectorTaskDe;
	}


	public List<ConnectorTask> getListaConnectorTaskPara() {
		return listaConnectorTaskPara;
	}


	public void setListaConnectorTaskPara(List<ConnectorTask> listaConnectorTaskPara) {
		this.listaConnectorTaskPara = listaConnectorTaskPara;
	}
	
    
    
	
	
}
